PAGINA 1

COLUMNA

COMPONENTE TABLA

PAGINA 2

FILA 1

GRAFICO 1

FILA 2

GRAFICO 2

PAGINA 3

COLUMNA

COMPONENTE TEXTO

---
title: "DASHBOARD PRUEBA BGG"
author: Beatriz G. Gálvez
output: 
  flexdashboard::flex_dashboard:
    vertical_layout: scroll
    source_code: embed
    logo: logos/woman.png
    social: ["twiter"]
    theme: yeti
---
```{r}
library(readr)   
library(readxl)
library(ggplot2)
library(dplyr)
library(flexdashboard)
library(DT)
df <- read_delim("datos_tratados.csv", delim = ";", escape_double = FALSE, trim_ws = TRUE)
View(df)

df$CURSO <- factor(df$CURSO)
df$CENTRO <- factor(df$CENTRO)

df_3 <- filter(df, CENTRO == "FARMACIA" | CENTRO == "MEDICINA")

df_3$CURSO <- factor(df_3$CURSO)
df_3$CENTRO <- factor(df_3$CENTRO)
df_4 <- filter(df, CURSO == "2022-2023")

ggplot(df_3) +
  geom_col(aes(x = CURSO, y = TOTAL, fill = CENTRO)) +
  labs(subtitle = "Gráfico con fill = CENTRO",
       x = "Curso",
       y = "Total de alumno/as."
  ) +
  theme(axis.text.x = element_text(angle = 30, vjust = 1, hjust = 1, size = 8),
        # arriba(top), izquierda (left), derecha (right), abajo (bottom)
        legend.position = "right"  
        ) 

ggplot(df_3) +
  geom_boxplot(aes(x= CENTRO, y = TOTAL, fill = CENTRO)) +
  labs(title = "Distribución de las matrículas en la UCM",
       subtitle = "Gráficos de cajas, (geom_boxplot)",
       x = " ",
       y = "Número de matriculas por año \n"
  ) + 
  theme(axis.text.x = element_blank()) 

 
ggplot(df_3) +
  geom_boxplot(aes(x= CENTRO, y = TOTAL, fill = CENTRO)) +
  labs(title = "Distribución de las matrículas en la UCM",
       subtitle = "Gráficos de cajas, (geom_boxplot)",
       x = " ",
       y = "Número de matriculas por año \n"
  ) + 
  theme(axis.text.x = element_blank()) 
       



df_4_M <- select(df_3,CURSO,CENTRO,TOTAL_MUJERES,PORC_MUJERES)
df_4_H <- select(df_3,CURSO,CENTRO,TOTAL_HOMBRES,PORC_HOMBRES)

colnames(df_4_M)[3] <-"TOTAL"
colnames(df_4_H)[3] <-"TOTAL"
colnames(df_4_M)[4] <-"PORCENTAJE"
colnames(df_4_H)[4] <-"PORCENTAJE"


df_4_M$SEXO <- rep('Mujer', times = nrow(df_4_M))
df_4_H$SEXO <- rep('Hombre', times = nrow(df_4_H))


df_5 <- bind_rows(df_4_M,df_4_H)


ggplot(df_5) +
  geom_boxplot(aes(y=TOTAL, x = CENTRO, fill = SEXO) ) +
  labs(title = "Distribución de las mujeres y hombres que estudian en la UCM",
       subtitle = "Gráficos de cajas, (geom_boxplot).",
       x = " ",
       y = "Número de estudiantes \n ",
       caption = "Fuente: El Centro de Inteligencia Institucional, UCM."
  ) +
  theme(axis.text.x = element_text(size = 10),
        #arriba(top), izquierda (left), derecha (right)
        legend.position = "top",
  )




```


# PAGINA 1
## COLUMNA {data-width=350}
### COMPONENTE TABLA

# PAGINA 2 {data-orientation=row}
## FILA 1
### GRAFICO 1
## FILA 2
### GRAFICO 2

# PAGINA 3
## COLUMNA {data-width=650}
### COMPONENTE TEXTO